package com.big_event.mapper;

import com.big_event.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

@Mapper
public interface UserMapper {
    //用户名查询
    @Select("select * from big_event.user where username=#{username}")
    User findByUserName(String username);
    //注册
    @Insert("insert into big_event.user(username, password, create_time, update_time)"+
            "values(#{username},#{password},now(),now())")
    void add(String username, String password);
    //更新用户详细信息
    @Update("update big_event.user set nickname=#{nickname},email=#{email},update_time=#{updateTime} where id=#{id}")
    void update(User user);
    //更新头像
    @Update("update big_event.user set user_pic=#{avatarUrl},update_time=now() where id=#{id}")
    void updateAvatar(String avatarUrl, Integer id);
    //更新密码
    @Update("update big_event.user set password=#{md5String} where id=#{id}")
    void updatePwd(String md5String, Integer id);




}
